-- Winter Anathema (c) v.v.balashoff
local Entity = require('leviathan/ECS/Entity')
local SplashscreenComponent = require('leviathan/ECS/Script/Components/SplashscreenComponent')

-- TODO move it to src/ECS/Core/Systems ?
function screen(v) -- screen constructor
-- TODO www
print('CREATING SCREEN: '..v.name)
    local core = world:getDomain('Core')
    local entity = Entity(v.name)
    entity.enabled = false

    local name = v.name
    local bgColor = v.color
    local image = v.image
    local text = v.text
    local duraion = v.duration
    local follow = v.follow
    local skip = v.skip
    local music = v.music
    local comp = SplashscreenComponent(name, bgColor, image, text, duration, follow, skip, music)
    entity:addComponent(comp)
    core:addEntity(entity)

--print_r(v)
--print_r(entity)
--os.exit()
    local way = {}
    way.tType = 'screen'
    way.map = nil
    ways[name] = way

    if v.name then
    else
        Log:error('Missing name in location!')
        error('Missing name in screen: ', 2)
    end
    v.screen = true
--    if base.screens[v.name] then
--        Log:warning('Location already loaded: '..v.name)
--    end
--    base.screens[v.name] = v
    return v
end
